﻿package {
	import flash.display.Sprite;
	import flash.events.Event;
	
	[SWF(backgroundColor="#FFFFFF", width=200, height=200, frameRate=10)]
	public class Main extends Sprite {
		
		public function Main():void {
			//draw a black square
			var ss:SignalSprite = new SignalSprite();
			ss.graphics.beginFill(0);
			ss.graphics.drawRect(0, 0, 200, 200);
			addChild(ss);
			
			//listen to the mouse click signal instead of the native event
			ss.onMouseClick.add(traceMouseClick);
			
			//the listener will be invoked once and then removed
			ss.onEnterFrame.addOnce(traceEnterFrame);
		}
		
		private function traceMouseClick(e:Event):void {
			trace("mouse clicked");
		}
		
		private function traceEnterFrame(e:Event):void {
			trace("frame entered");
		}
	}
}